import React, { ReactNode } from 'react';
import { LoadingProvider } from './LoadingManager';
import { ErrorProvider } from './ErrorHandler';
import { FeedbackProvider } from './UserFeedback';

interface FeedbackSystemProps {
  children: ReactNode;
  onErrorReport?: (error: any) => void;
}

/**
 * 统一的反馈系统提供者
 * 整合了加载状态、错误处理和用户反馈
 * 注意：Toast通知现在使用Ant Design的message组件，需要在App组件中配置
 */
export const FeedbackSystem: React.FC<FeedbackSystemProps> = ({ 
  children, 
  onErrorReport 
}) => {
  return (
    <ErrorProvider onErrorReport={onErrorReport}>
      <LoadingProvider>
        <FeedbackProvider>
          {children}
        </FeedbackProvider>
      </LoadingProvider>
    </ErrorProvider>
  );
};

export default FeedbackSystem;